﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SchoolLibrary.Entity;
using SchoolLibrary.DataBase.Builder;
using SchoolLibrary.Entity.Person;

namespace SchoolLibrary.DataBase.Builder.Factory
{
    public class EntityBuilderFactory
    {
        private EntityBuilderFactory() { }

        public static AbstractEntityBuilder getBuilder(Type type)
        {
            AbstractEntityBuilder builder;
            if (typeof(Book).Equals(type))
            {
                builder = new BookBuilder();
            }
            else if (typeof(Writer).Equals(type))
            {
                builder = new WriterBuilder();
            }
            else if (typeof(Pupil).Equals(type))
            {
                builder = new PupilBuilder();
            } 
            else if (typeof(ClassLeader).Equals(type))
            {
                builder = new ClassLeaderBuilder();
            } 
            else if (typeof(Class).Equals(type))
            {
                builder = new ClassBuilder();
            }
            else if (typeof(RegistryJournal).Equals(type))
            {
                builder = new RegistryJournalBuilder();
            }
            else if (typeof(Genre).Equals(type))
            {
                builder = new GenreBuilder();
            }
            else
            {
                throw new ArgumentException();
            }
            return builder;
        }
    }
}
